﻿<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:myconv="clr-namespace:FreeRecorderExplorer.Converters"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="FreeRecorderExplorer.MainWindow"
        Title="Free Recorder Explorer" Height="440" MinHeight="150" Width="650" MinWidth="450" Loaded="Window_Loaded_1" Closed="Window_Closed_1">
    <Window.Resources>
        <myconv:BoolToColorConverter x:Key="colorConv" />
        <myconv:BoolToStatusConverter x:Key="statusConv" />
        <myconv:SizeConverter x:Key="sizeConv" />
        <myconv:AddressConverter x:Key="addrConv" />
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="110"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid Grid.Row="0" x:Name="headerGrid">
            <TextBlock HorizontalAlignment="Left" Margin="10,14,0,0" TextWrapping="Wrap" Text="Status: " VerticalAlignment="Top" FontFamily="Segoe UI Semilight"/>
            <TextBlock HorizontalAlignment="Left" Margin="10,35,0,0" TextWrapping="Wrap" Text="Device: " VerticalAlignment="Top" FontFamily="Segoe UI Semilight" />
            <TextBlock x:Name="txtConnection" HorizontalAlignment="Left" Margin="82,14,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="160" Text="{Binding IsDeviceConnected, Converter={StaticResource statusConv}}" Foreground="{Binding IsDeviceConnected, Converter={StaticResource colorConv}}" FontWeight="Bold" FontFamily="Segoe UI SemiLight"/>
            <TextBlock x:Name="txtDevice" Text="{Binding ConnectedDeviceName}" HorizontalAlignment="Left" Margin="82,35,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="143" FontFamily="Segoe UI SemiLight"/>
            <TextBox x:Name="txtDirectory" Height="23" Margin="259,32,95.1,0" Text="C:/Program Files/MyFolder/" VerticalAlignment="Top" IsReadOnly="True" VerticalContentAlignment="Center" FontSize="11" FontFamily="Segoe UI Semilight"/>
            <Button x:Name="btnChangeDir" Content="Change" Margin="0,32,10,0" VerticalAlignment="Top" Width="75" Height="23" Click="btnChangeDir_Click" FontFamily="Segoe UI Semilight" HorizontalAlignment="Right"/>
            <TextBlock HorizontalAlignment="Left" Margin="260,14,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="181" Height="16" FontFamily="Segoe UI Semilight"><Run Text="Download Path:"/><LineBreak/><Run/><LineBreak/><Run Text="v"/></TextBlock>
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="10,0,0,37" VerticalAlignment="Bottom">
                <TextBlock Text="IP Address: " FontFamily="Segoe UI SemiLight" />
                <TextBlock Text="{Binding LocalEndpoint.Address, Converter={StaticResource addrConv}}" FontFamily="Segoe UI Semilight" Margin="10,0,10,0"/>
                <TextBlock Text="Port: " FontFamily="Segoe UI SemiLight" />
                <TextBlock Text="{Binding LocalEndpoint.Port}" FontFamily="Segoe UI Semilight" Margin="10,0,10,0"/>
            </StackPanel>
            <Button x:Name="btnDownload" Content="Download" HorizontalAlignment="Left" Margin="90,82,0,0" VerticalAlignment="Top" Width="75" Click="btnDownload_Click"  Height="23" FontFamily="Segoe UI Semilight"/>
            <TextBlock x:Name="txtDownloadingFile" FontFamily="Segoe UI Semilight" HorizontalAlignment="Left" Margin="294,86,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="338" Visibility="Collapsed"><Run Text="Downloading file:"/></TextBlock>
            <ProgressBar x:Name="pbDownloading" HorizontalAlignment="Left" Height="20" Margin="294,62,0,0" VerticalAlignment="Top" Width="215" Visibility="Collapsed"/>
            <Button x:Name="btnConnection" Content="Connection" HorizontalAlignment="Left" Margin="10,82,0,0" VerticalAlignment="Top" Width="75" Click="btnConnection_Click" Height="23" FontFamily="Segoe UI Semilight"/>
            <TextBlock x:Name="txtPercent" FontFamily="Segoe UI Semilight" HorizontalAlignment="Left" Margin="514,64,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" FontSize="11" Visibility="Collapsed"/>
            <Button x:Name="btnDownloadAll" Content="Download All" HorizontalAlignment="Left" Margin="170,82,0,0" VerticalAlignment="Top" Width="90" Click="btnDownloadAll_Click" Height="23" FontFamily="Segoe UI Semilight"/>
            <Button x:Name="btnInfo" HorizontalAlignment="Right" Margin="0,3,10,0" VerticalAlignment="Top" Width="25" IsCancel="True" Click="btnInfo_Click">
                <Image Source="Images/info.png" Stretch="Uniform" />
            </Button>
        </Grid>
        <Grid Grid.Row="1">

            <!--<DataGrid x:Name="dgRecordings" Margin="5,20,5,5" ItemsSource="{Binding}" IsReadOnly="True" AutoGenerateColumns="False" Visibility="Collapsed">
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding Name}"  Header="Name" MinWidth="150"/>
                    <DataGridTextColumn Binding="{Binding DurationUI}"  Header="Duration" MinWidth="75">
                        <DataGridTextColumn.CellStyle>
                            <Style>
                                <Setter Property="FrameworkElement.HorizontalAlignment" Value="Center" />
                            </Style>
                        </DataGridTextColumn.CellStyle>
                    </DataGridTextColumn>
                    <DataGridTextColumn Binding="{Binding Size}"  Header="Size" MinWidth="75"/>
                    <DataGridTextColumn Binding="{Binding Description}"  Header="Description" MinWidth="200" SortMemberPath="Name" Width="*"/>
                </DataGrid.Columns>

            </DataGrid>-->
            <TextBlock HorizontalAlignment="Left" Margin="10,2,0,0" TextWrapping="Wrap" Text="Recordings" VerticalAlignment="Top" FontFamily="Segoe UI Semilight"/>
            <ListView Margin="5,20,5,5" x:Name="listviewRecordings" ItemsSource="{Binding}" SelectionChanged="listviewRecordings_SelectionChanged">
                <ListView.View>
                    <GridView>
                        <GridViewColumn>
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal">
                                        <Image Source="Images/wav1.png" Width="16" Margin="0,0,3,0"/>
                                        <TextBlock Text="{Binding Name}" FontFamily="Segoe UI Semilight" MinWidth="150"/>
                                    </StackPanel>
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>

                            <TextBlock Text="Name" FontFamily="Segoe UI Semilight" />

                        </GridViewColumn>
                        <GridViewColumn>
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding DurationUI}" FontFamily="Segoe UI Semilight" MinWidth="75" TextAlignment="Center"/>
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                            <TextBlock Text="Duration" FontFamily="Segoe UI Semilight" />
                        </GridViewColumn>
                        <GridViewColumn>
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Size, Converter={StaticResource sizeConv}}"  FontFamily="Segoe UI Semilight" MinWidth="75" Margin="15,0,0,0"/>
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                            <TextBlock Text="Size" FontFamily="Segoe UI Semilight" />
                        </GridViewColumn>
                        <GridViewColumn>
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Description}" MinWidth="200"/>
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                            <TextBlock Text="Description" FontFamily="Segoe UI Semilight" />
                        </GridViewColumn>
                    </GridView>
                </ListView.View>
            </ListView>

        </Grid>

    </Grid>
</Window>
